package com.fw.ui.view.settings.usercontrol.bouser.event;

import static org.springframework.beans.factory.config.BeanDefinition.SCOPE_PROTOTYPE;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.fw.ui.util.UICommonUtils;
import com.fw.ui.util.VaadinApplicationObjectSupport;
import com.fw.ui.view.event.AbstractButtonClickListener;
import com.fw.ui.view.settings.usercontrol.bouser.CreateBOUserView;
import com.vaadin.ui.Button.ClickEvent;

@Component
@Scope(SCOPE_PROTOTYPE)
public class CreateBOUserClearButtonClickListener extends AbstractButtonClickListener {

    private static final long serialVersionUID = 482478998438351054L;

    @Autowired
    protected transient VaadinApplicationObjectSupport app;
    @Autowired
    private UICommonUtils uiCommonUtils;

    @Override
    public Map<String, Object> click(ClickEvent event) {
	CreateBOUserView createBOUserView = (CreateBOUserView) this.getBasedComponent();

	uiCommonUtils.clearValueAllUIComponentExcludeLabel(createBOUserView);
	uiCommonUtils.setVisibleAllUIComponentWithIncludePrefix(createBOUserView, false);

	return null;

    }

    @Override
    public boolean validate(ClickEvent event) {
	return true;
    }

}
